﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;

namespace Uinside.CreditSystem.DomainModels.Models
{
    public partial class Order : BaseModel
    {
        private string _orderNumber;
        [MaxLength(20)]
        public string OrderNumber
        {
            get
            {
                return _orderNumber;
            }
            set
            {
                SetField(ref _orderNumber, value, "OrderNumber");
            }
        }

        private int _statusId;
        public int StatusId
        {
            get { return _statusId; }
            set { SetField(ref _statusId, value, "StatusId"); }
        }

        private Setting _status;
        [ForeignKey("StatusId")]
        public virtual Setting Status
        {
            get { return _status; }
            set { SetField(ref _status, value, "Status"); }
        }

        private int _borrowerId;
        public int BorrowerId
        {
            get { return _borrowerId; }
            set { SetField(ref _borrowerId, value, "BorrowerId"); }
        }

        private Customer _borrower;
        [ForeignKey("BorrowerId")]
        public virtual Customer Borrower
        {
            get { return _borrower; }
            set { SetField(ref _borrower, value, "Borrower"); }
        }


        private int _lenderId;
        public int LenderId
        {
            get { return _lenderId; }
            set { SetField(ref _lenderId, value, "LenderId"); }
        }

        private Customer _lender;
        [ForeignKey("LenderId")]
        public virtual Customer Lender
        {
            get { return _lender; }
            set { SetField(ref _lender, value, "Lender"); }
        }

        private int _borrowedYear;
        public int BorrowedYear
        {
            get { return _borrowedYear; }
            set { SetField(ref _borrowedYear, value, "BorrowedYear"); }
        }

        private int _borrowedMonth;
        public int BorrowedMonth
        {
            get { return _borrowedMonth; }
            set { SetField(ref _borrowedMonth, value, "BorrowedMonth"); }
        }

        private int _borrowedDay;
        public int BorrowedDay
        {
            get { return _borrowedDay; }
            set { SetField(ref _borrowedDay, value, "BorrowedDay"); }
        }

        private DateTime _returnDate;
        /// <summary>
        /// 还款日期
        /// </summary>
        public DateTime ReturnDate
        {
            get { return _returnDate; }
            set { SetField(ref _returnDate, value, "ReturnDate"); }
        }

        private int _interestType;
        /// <summary>
        /// 0 ---- Fix
        /// 1 ---- Date
        /// </summary>
        public int InterestType
        {
            get { return _interestType; }
            set
            {
                SetField(ref _interestType, value, "InterestType");
            }
        }

        private int _interestDateType;
        /// <summary>
        /// 0 ---- day
        /// 1 ---- month
        /// 2 ---- year
        /// </summary>
        public int InterestDateType
        {
            get { return _interestDateType; }
            set { SetField(ref _interestDateType, value, "InterestDateType"); }
        }

        private double _interestRate;
        public double InterestRate
        {
            get
            {
                return _interestRate;
            }
            set { SetField(ref _interestRate, value, "InterestRate"); }
        }


        private double _interestRatePerDay;
        /// <summary>
        /// 每天的利率
        /// </summary>
        public double InterestRatePerDay
        {
            get
            {
                return _interestRatePerDay;
            }
            set { SetField(ref _interestRatePerDay, value, "InterestRatePerDay"); }
        }

        private DateTime _createDate;
        public DateTime CreateDate
        {
            get { return _createDate; }
            set { SetField(ref _createDate, value, "CreateDate"); }
        }

        private int _returnInterestType;
        /// <summary>
        /// 0---- once
        /// 1---- many times
        /// </summary>
        public int ReturnInterestType
        {
            get { return _returnInterestType; }
            set { SetField(ref _returnInterestType, value, "ReturnInterestType"); }
        }

        private DateTime? _returnInterestDate;

        /// <summary>
        /// Only available when Return type is once
        /// </summary>
        public DateTime? ReturnInterestDate
        {
            get { return _returnInterestDate; }
            set { SetField(ref _returnInterestDate, value, "ReturnInterestDate"); }
        }


        private int _returnInterestDateType;
        /// <summary>
        /// 0--- 月
        /// 1--- 季度
        /// 2--- 年
        /// 分期还款类型
        /// </summary>
        public int ReturnInterestDateType//RemindType
        {
            get { return _returnInterestDateType; }
            set { SetField(ref _returnInterestDateType, value, "ReturnInterestDateType"); }
        }

        private int _priorToRemind;
        public int PriorToRemind
        {
            get { return _priorToRemind; }
            set { SetField(ref _priorToRemind, value, "PriorToRemind"); }
        }

        private ObservableCollection<Payment> _payments;
        public virtual ObservableCollection<Payment> Payments
        {
            get
            {
                return _payments;
            }
            set { SetField(ref _payments, value, "Payments"); }
        }

        private decimal _sumOfLoan;
        public decimal SumOfLoan
        {
            get { return _sumOfLoan; }
            set { SetField(ref _sumOfLoan, value, "SumOfLoan"); }
        }

        /// <summary>
        /// 打款凭证
        /// </summary>
        private ObservableCollection<Image> _paymentCertificats;
        public virtual ObservableCollection<Image> PaymentCertificats
        {
            get { return _paymentCertificats; }
            set { SetField(ref _paymentCertificats, value, "PaymentCertificats"); }
        }

        /// <summary>
        /// 还款凭证
        /// </summary>
        private ObservableCollection<Image> _receiptCertificats;
        public virtual ObservableCollection<Image> ReceiptCertificats
        {
            get { return _receiptCertificats; }
            set { SetField(ref _receiptCertificats, value, "ReceiptCertificats"); }
        }

        /// <summary>
        /// 合同凭证
        /// </summary>
        private ObservableCollection<Image> _contractCertificats;
        public virtual ObservableCollection<Image> ContractCertificats
        {
            get { return _contractCertificats; }
            set { SetField(ref _contractCertificats, value, "ContractCertificats"); }
        }
    }
}
